package com.simple.piger.controller;


import com.simple.piger.utils.AjaxResult;
import com.simple.piger.constant.AjaxCode;

/**
 * 共通抽象Controller
 * @Author  donghj
 * @Date    2017/11/16 13:45
 */
public abstract class AbstractController {

    protected AjaxResult success() {
        return new AjaxResult(200, "success");
    }

    protected AjaxResult success(Object data) {
        return new AjaxResult(200, "success", data);
    }

    protected AjaxResult success(int total, Object data) {
        return new AjaxResult(200, "success", total, data);
    }

    protected AjaxResult fail(AjaxCode ajaxCode) {
        return new AjaxResult(ajaxCode);
    }

    protected AjaxResult fail(AjaxCode ajaxCode, Object data) {
        return new AjaxResult(ajaxCode, data);
    }

    protected AjaxResult fail(String msg) {
        return new AjaxResult(AjaxCode.BUSINESS_INFO, msg);
    }
}